home *** CD-ROM | disk | FTP | other *** search
- ===============================================
- Ch 9 − Mail-Merging with Impression and Ovation
- ===============================================
-
- Although the title refers to “Mail-Merging” the process to be described is
- more accurately termed “Data-Merging” as it is by no means limited to
- merging names and addresses into letters or labels; any kind of textual data
- from a Powerbase application can be merged into any kind of document in
- Impression or Ovation or many other editors and wordprocessors.
-
- 9.1 Mail-merging with Ovation
- ---------------------------------
- Ovation expects data for merging to be supplied as a CSV file. An example
- file (OvationCSV) is supplied with this version of Powerbase. It was created
- from the Elements database and is intended to work with the sample Ovation
- document OmergeTest. Before attempting to create CSV files of your own you
- are recommended to read the Powerbase documentation on such files (see Ch
- 8). The process for mail-merging with Ovation is described below.
-
- 9.1.1 Preparing an Ovation document for mail-merging
-
- Ovation has a very easy method of specifying where the merged data is to go
- into the document. Whenever you reach a point where you wish to insert a
- Powerbase field type Ctrl I. A window headed “Merge tag” will appear
- inviting you to enter a number. The number required is the field number in
- the CSV record (which is not necessarily the field number in the Powerbase
- record). If, for instance, you wish to merge the second field from each line
- of your CSV file enter 2 and type Return. You will see that “[Merge2]” has
- been inserted into the text at the caret. Continue typing, inserting other
- fields as required. The fields do not need to be in numerical order (you can
- insert field 2 before you insert field 1) and the same field may be inserted
- many times. Styles and effects may be applied to the Merge tags. Load
- OmergeTest to see how this looks.
-
- 9.1.2 Merging the data from Powerbase
-
- With OmergeTest loaded, open the main Ovation menu, go to the File submenu
- and choose Print. Select the Mail merge option button and drag OvationCSV to
- the writable icon to the right of the button. The pathname of the file will
- appear in the icon. Click on OK and the document will be printed once for
- each record in the CSV file, merging new data into the document each time.
- OvationCSV contains 10 records so if you just want to see the process in
- action without actually printing 10 sheets of paper set your printer manager
- to print to a file instead of to the printer itself.
-
- If you examine OvationCSV you will see that each field is enclosed in
- quotes. This is only necessary of the fields contain literal commas (see
- 8.1). Look at the first record, for example, and note the comma in
- “(Gr.aktis,aktinos; ray or beam)”. Without the quotes Ovation would
- interpret the comma as a field separator and the merging would get out of
- step for that record.
-
- 9.2 Mail-merging with Impression
- ------------------------------------
- The following description applies to Impression Publisher and Impression
- Style. The older ImpressionII is also supported. Powerbase and Impression
- are able to communicate directly with each other without the need for a CSV
- file. This task is performed by a module called ImpulseII which Computer
- Concepts have placed in the public domain to encourage its adoption as a
- standard means of transferring data between RISC OS applications. The
- ImpulseII module is included in the !Powerbase.Resources.Modules directory.
-
- 9.2.1 Preparing the Impression document
-
- Since the merged data is not being supplied from a pre-generated CSV file
- Impression needs to request specifically each Powerbase field that it wants
- to merge into the document. It is probably best to create the document
- without worrying about the merged data at first, then insert the necessary
- commands afterwards.
-
- Wherever you want data from a Powerbase record to appear in the document
- proceed as follows:
-
- (1) Place the caret at the point where the data is to be inserted.
-
- (2) Click MENU over the frame, go to the Utilities submenu (Misc in
- ImpressionII) and choose Merge command. A dialogue box will appear.
-
- - 48 -
-
- (3) Type the following:
-
- :Powerbase GetField NAME
-
- This is on the understanding that your Powerbase record contains a field
- whose tag is NAME and that you want the contents of that field inserting
- into the Impression document at that point. Note the spaces and the initial
- colon. These are essential.
-
- (4) Click on Set or type Return. You will see “<NAME>” appear in the
- text.
-
- (5) Repeat for all the other Powerbase fields to be inserted in the
- document. All take the form:−
-
- :Powerbase GetField <tag>
-
- and in each case the tag, enclosed in angle brackets, will appear in the
- text. All the data in a given document must come from the same database. It
- might be easiest if you open the required database and arrange the desktop
- so that you can see both the record window and the Impression document.
- Clicking MENU over a field makes its tag appear in the second item of the
- main Powerbase menu. Copy it exactly into the Merge command window.
-
- (6) Save the the document!
-
- 9.2.2 Merging the data
-
- (1) Make sure Impression has been “seen” by the filer then open the
- Powerbase database.
-
- (2) Drop the Impression document on the record window. The document
- will be loaded and displayed then Powerbase’s Data Merge window will
- appear. (If Impression isn’t already running Powerbase will run it
- for you.)
-
- (3) Clicking on Merge extracts data from either the first record or, if
- the Merge from displayed record switch is set, the
- currently-displayed record, and inserts it in the specified places
- in the Impression document. You can see this happening if the
- relevant parts of the document are visible. Using the keypad to
- browse, search or change subfiles or keys now causes the accessed
- records to be merged into the document instead of being displayed in
- the record window. If a filter (see 2.3.3) is active this will also
- be obeyed. Each time a record is merged its data overwrites that
- from the previous record.
-
- (4) If your printer is on-line and the printer driver loaded you may
- print the document with the merged data by clicking on Print. If
- the Print all switch is selected before Merge is clicked Powerbase
- will proceed through the database from whichever record you first
- merged, merging each record in turn (or each matching record if a
- filter is in use) and printing for each record a copy of the
- document containing the merged data.
-
- Note that when the mouse pointer is moved over the Impression document with
- the merged data present it changes to a large red and blue cross which means
- that you cannot edit the document. Clicking SELECT over it has no effect;
- the caret doesn’t appear. If you click on Cancel in the Data merge window
- the merged data is removed from the document and normal editing is restored.
- If you do want to edit the document with merged data present then click on
- Edit. Note, however, that if you save the document in this state it will be
- saved with the specific data you have merged into it rather than with the
- commands to merge data. Appendix A gives a full description of the Impulse
- commands or “methods” which Powerbase understands.
-
- 9.3 Mail-merging with other programs
- ----------------------------------------
- If you use neither Impression nor Ovation you may still be able to use
- mail-merging with your wordprocessor, but you will need to read the manual
- carefully to find out how. It will almost certainly involve a CSV, or
- similar, file in conjunction with some method of “tagging” the document (as
- described above for Impression and Ovation) to specify where in it the data
- is to be merged.
-
- - 49 -